-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add HTTP client configuration support for Spring AI models #4970
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: yinh <[email protected]>
Signed-off-by: yinh <[email protected]>
Signed-off-by: yinh <[email protected]>
Signed-off-by: yinh <[email protected]>
0cfb84c to
5cafbb2
Compare
Signed-off-by: yinh <[email protected]>
Signed-off-by: yinh <[email protected]>
Signed-off-by: yinh <[email protected]>
785b410 to
109c099
Compare
Signed-off-by: yinh <[email protected]>
Signed-off-by: yinh <[email protected]>
Signed-off-by: yinh <[email protected]>
Signed-off-by: yinh <[email protected]>
Signed-off-by: yinh <[email protected]>
…y using HttpClientSettingsProperties don't adjust XxxConnectionProperties inheritance relationships Signed-off-by: yinh <[email protected]>
Signed-off-by: yinh <[email protected]>
fe18cd3 to
1f0cdf8
Compare
Signed-off-by: yinh <[email protected]>
SummaryThis PR adds comprehensive HTTP client configuration support (timeouts, SSL, redirects) for 12 Spring AI model providers. The implementation is based on each provider's underlying HTTP client, ensuring consistency with Spring Boot's configuration patterns while maintaining backward compatibility. Scope of ChangesModified Providers (12 total)
Providers Not Modified
Implementation ApproachPattern 1: RestClient-based Providers (Recommended)Applied to 10 providers using Spring RestClient with Providers: DeepSeek, Anthropic, ElevenLabs, Google GenAI, MiniMax, Mistral AI, Ollama, OpenAI, Stability AI, ZhiPu AI Key Components:
Configuration Example: spring:
ai:
deepseek:
api-key: ${DEEPSEEK_API_KEY}
http-client:
enabled: true
connect-timeout: 10s
read-timeout: 60s
redirects: follow
ssl-bundle: my-ssl-bundlePattern 2: Azure SDK-based ProvidersApplied to 2 providers using Azure/OCI SDKs with direct timeout configuration in ConnectionProperties. Providers: Azure OpenAI, OCI GenAI Key Components:
Configuration Example: spring:
ai:
azure:
openai:
api-key: ${AZURE_OPENAI_API_KEY}
endpoint: ${AZURE_OPENAI_ENDPOINT}
connect-timeout: 10s
read-timeout: 90sKey Design Decisions
Code Statistics
Main File Types Changed
Commit HistoryChronological commit log:
Usage ExamplesBasic Configurationspring:
ai:
openai:
api-key: ${OPENAI_API_KEY}
http-client:
connect-timeout: 15s
read-timeout: 120sAdvanced Configuration (SSL + Redirects)spring:
ai:
anthropic:
api-key: ${ANTHROPIC_API_KEY}
http-client:
connect-timeout: 10s
read-timeout: 90s
redirects: follow
ssl-bundle: custom-sslDisable Custom Configurationspring:
ai:
deepseek:
api-key: ${DEEPSEEK_API_KEY}
http-client:
enabled: false # Use default RestClient configurationTestingAll modified providers include:
Related IssueResolves #4934 Future Work
Notes
|
Document HTTP client configuration options for 12 model providers, enabling users to customize timeouts, connection pools, and SSL settings. Changes: - Add HTTP client properties documentation for RestClient-based providers (DeepSeek, Anthropic, OpenAI, Ollama, MiniMax, Mistral AI, ZhiPu AI, Stability AI, ElevenLabs) - Add timeout and connection pool properties for Azure OpenAI - Add timeout and connection properties for Google GenAI - Add timeout and async thread properties for OCI GenAI All properties are optional with no default values, allowing users to configure HTTP client behavior based on their specific requirements. Signed-off-by: yinh <[email protected]>
Summary
Add HTTP client configuration support (timeouts, SSL, etc.) for Spring AI model providers where applicable. Each provider's configuration depends on its underlying HTTP client implementation.
Changes
This PR adds HTTP client configuration properties for the following providers:
DeepSeek
Anthropic
(Add other models you modified...)
Notes
#4934